package com.lx.lottery.api.domain.receive.service.logic.impl;

import com.lx.lottery.api.domain.receive.model.BehaviorMatter;
import com.lx.lottery.api.domain.receive.service.logic.LogicFilter;
import com.lx.lottery.rpc.activity.booth.ILotteryActivityBooth;
import com.lx.lottery.rpc.activity.booth.dto.AwardDTO;
import com.lx.lottery.rpc.activity.booth.req.DrawReq;
import com.lx.lottery.rpc.activity.booth.res.DrawRes;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.stereotype.Service;

/**
 * @author lX
 * @version JDK 8
 * @className LotteryLogicFilter (此处以class为例)
 * @date 2024/3/25
 * @description TODO
 */
@Service
public class LotteryLogicFilter implements LogicFilter {

    @Reference(interfaceClass = ILotteryActivityBooth.class,url = "dubbo://localhost:20880")
    private ILotteryActivityBooth lotteryActivityBooth;

    @Override
    public String filter(BehaviorMatter request) {
        DrawReq drawReq = new DrawReq();
        drawReq.setuId(request.getOpenId().substring(1, 11));
        drawReq.setActivityId(100001L);

//        DrawRes drawRes = lotteryActivityBooth.doDraw(drawReq);
//        AwardDTO awardDTO = drawRes.getAwardDTO();
//        if (!"0000".equals(drawRes.getCode())) {
//            return "抽奖💐 提示：" + drawRes.getInfo();
//        }

        return "恭喜💐 您已中奖：" +   " 给你两个大嘴巴子";

    }
}
